/*
 * XML Type:  ForkNode
 * Namespace: http:///org/isistan/flabot/coremodel.ecore
 * Java type: org.isistan.flabot.coremodelEcore.ForkNode
 *
 * Automatically generated - do not modify.
 */
package org.isistan.flabot.coremodelEcore.impl;
/**
 * An XML ForkNode(@http:///org/isistan/flabot/coremodel.ecore).
 *
 * This is a complex type.
 */
public class ForkNodeImpl extends org.isistan.flabot.coremodelEcore.impl.ResponsibilityNodeImpl implements org.isistan.flabot.coremodelEcore.ForkNode
{
    private static final long serialVersionUID = 1L;
    
    public ForkNodeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName CONDITIONS$0 = 
        new javax.xml.namespace.QName("", "conditions");
    private static final javax.xml.namespace.QName FORKTYPE$2 = 
        new javax.xml.namespace.QName("", "forkType");
    
    
    /**
     * Gets array of all "conditions" elements
     */
    public org.isistan.flabot.coremodelEcore.ForkCondition[] getConditionsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(CONDITIONS$0, targetList);
            org.isistan.flabot.coremodelEcore.ForkCondition[] result = new org.isistan.flabot.coremodelEcore.ForkCondition[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "conditions" element
     */
    public org.isistan.flabot.coremodelEcore.ForkCondition getConditionsArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.ForkCondition target = null;
            target = (org.isistan.flabot.coremodelEcore.ForkCondition)get_store().find_element_user(CONDITIONS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "conditions" element
     */
    public int sizeOfConditionsArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(CONDITIONS$0);
        }
    }
    
    /**
     * Sets array of all "conditions" element  WARNING: This method is not atomicaly synchronized.
     */
    public void setConditionsArray(org.isistan.flabot.coremodelEcore.ForkCondition[] conditionsArray)
    {
        check_orphaned();
        arraySetterHelper(conditionsArray, CONDITIONS$0);
    }
    
    /**
     * Sets ith "conditions" element
     */
    public void setConditionsArray(int i, org.isistan.flabot.coremodelEcore.ForkCondition conditions)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.ForkCondition target = null;
            target = (org.isistan.flabot.coremodelEcore.ForkCondition)get_store().find_element_user(CONDITIONS$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(conditions);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "conditions" element
     */
    public org.isistan.flabot.coremodelEcore.ForkCondition insertNewConditions(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.ForkCondition target = null;
            target = (org.isistan.flabot.coremodelEcore.ForkCondition)get_store().insert_element_user(CONDITIONS$0, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "conditions" element
     */
    public org.isistan.flabot.coremodelEcore.ForkCondition addNewConditions()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.ForkCondition target = null;
            target = (org.isistan.flabot.coremodelEcore.ForkCondition)get_store().add_element_user(CONDITIONS$0);
            return target;
        }
    }
    
    /**
     * Removes the ith "conditions" element
     */
    public void removeConditions(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(CONDITIONS$0, i);
        }
    }
    
    /**
     * Gets the "forkType" attribute
     */
    public int getForkType()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(FORKTYPE$2);
            if (target == null)
            {
                return 0;
            }
            return target.getIntValue();
        }
    }
    
    /**
     * Gets (as xml) the "forkType" attribute
     */
    public org.apache.xmlbeans.XmlInt xgetForkType()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().find_attribute_user(FORKTYPE$2);
            return target;
        }
    }
    
    /**
     * True if has "forkType" attribute
     */
    public boolean isSetForkType()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(FORKTYPE$2) != null;
        }
    }
    
    /**
     * Sets the "forkType" attribute
     */
    public void setForkType(int forkType)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(FORKTYPE$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(FORKTYPE$2);
            }
            target.setIntValue(forkType);
        }
    }
    
    /**
     * Sets (as xml) the "forkType" attribute
     */
    public void xsetForkType(org.apache.xmlbeans.XmlInt forkType)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlInt target = null;
            target = (org.apache.xmlbeans.XmlInt)get_store().find_attribute_user(FORKTYPE$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlInt)get_store().add_attribute_user(FORKTYPE$2);
            }
            target.set(forkType);
        }
    }
    
    /**
     * Unsets the "forkType" attribute
     */
    public void unsetForkType()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(FORKTYPE$2);
        }
    }
}
